function init(){
	if($("#idInput").val()){
		load()
	}else{
		selectAddOption("relationId","ci_relation","");
	}
	$("#signupForm").validate({
		submitHandler:function(form){
			save();
        }
	})
}

function load(){
	$.ajax({
		type : "GET",
		headers:PRIVATE_HEADERS,
		url : API_SERVER_URL + "cim/ciAuditRelation/getById/"+$("#idInput").val(),
		data : "",
		async : false,
		error : function(request) {
			parent.layer.alert("Connection error");
		},
		success : function(data) {
			$("#targetCi").val(data.targetCi);
			$("#targetCiVersion").val(data.targetCiVersion);
			$("#ciName").val(data.targetCiVo.name);
			selectAddOption("relationId","ci_relation",data.relationId);
		}
	});
}

function save() {
	var url = API_SERVER_URL + "cim/ciAuditRelation/save";
	if($("#idInput").val() && $("#idInput").val() != ""){
		url = API_SERVER_URL + "cim/ciAuditRelation/update";
	}
	$.ajax({
		cache : true,
		type : "POST",
		headers:PRIVATE_HEADERS,
		url : url,
		data : $('#signupForm').serialize(),// 你的formid
		async : false,
		error : function(request) {
			parent.layer.alert("Connection error");
		},
		success : function(data) {
			if (data.code == 0) {
				parent.layer.msg("操作成功");
				window.parent.reLoadRelation();
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);

			} else {
				parent.layer.alert(data.msg)
			}

		}
	});
}